﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RAMED
{
    public partial class ModifierCatreAjoutBordereau : Form
    {
        private Carte carte = new Carte();

        public Carte Carte
        {
            get { return carte; }
            set { carte = value; }
        }



        public Bordereau_Form bordereauForm { get; set; }


        public ModifierCatreAjoutBordereau()
        {
            InitializeComponent();
            RAMEDEntities1 Context = SingletonContext.GetContext();
            comboBoxcentresante.DataSource = Context.Centre_sante;
            comboBoxcentresante.DisplayMember = "nom_centre_sante";
            comboBoxcentresante.ValueMember = "id_centre_sante";
        }

        internal void InitialiserChamps()
        {
            txtnom.Text = carte.Nom_benefi;
            txtprenom.Text = carte.Prenom_benefi;
            txtipcm.Text = carte.IPCM.ToString();
            txtcin.Text = carte.CIN_benefi;

            comboBoxcentresante.SelectedValue = carte.id_centre_sante;
        }

        private void    btnenregistrer_Click(object sender, EventArgs e)
        {
            carte.Nom_benefi = txtnom.Text;
            carte.Prenom_benefi = txtprenom.Text;
            carte.CIN_benefi = txtcin.Text;
            carte.IPCM = txtipcm.Text;
            Centre_sante cs = new Centre_sante();
            cs = (Centre_sante)comboBoxcentresante.SelectedItem;
            carte.Centre_sante = cs;
            bordereauForm.mettreAjourFormGridView();
            this.Dispose();
        }
    }
}
